From ef6a692bf0e076c905a912fbb8e65481c354a7ca Mon Sep 17 00:00:00 2001
From: Phil Elwell <phil@raspberrypi.com>
Date: Wed, 23 Nov 2022 11:51:38 +0000
Subject: [PATCH] overlays: i2c-sensor: Make smbus-timeout-disable
 optional

Although disabling the SMBUS timeout may be useful, not all chips
support it. The driver treats attempting to disable the timeout on a
non-supporting chip as an error, so make it an option enabled using the
no_timeout parameter.

Signed-off-by: Phil Elwell <phil@raspberrypi.com>
---
 arch/arm/boot/dts/overlays/README                 | 5 +++++
 arch/arm/boot/dts/overlays/i2c-sensor-common.dtsi | 2 +-
 2 files changed, 6 insertions(+), 1 deletion(-)

--- a/arch/arm/boot/dts/overlays/README
+++ b/arch/arm/boot/dts/overlays/README
@@ -1999,6 +1999,11 @@ Params: addr                    Set the
                                 use the "jc42" option.
                                 Valid addresses are 0x18-0x1f (default 0x18)
 
+        no_timeout              Disable the SMBUS timeout. N.B. Only supported
+                                by some jc42 devices - using with an
+                                incompatible device can stop it from being
+                                activated.
+
         sht3x                   Select the Sensiron SHT3x temperature and
                                 humidity sensor. Valid addresses 0x44-0x45,
                                 default 0x44
--- a/arch/arm/boot/dts/overlays/i2c-sensor-common.dtsi
+++ b/arch/arm/boot/dts/overlays/i2c-sensor-common.dtsi
@@ -347,7 +347,6 @@
 			jc42: jc42@18 {
 				compatible = "jedec,jc-42.4-temp";
 				reg = <0x18>;
-				smbus-timeout-disable;
 			};
 		};
 	};
@@ -383,5 +382,6 @@
 			<&ds1621>,"reg:0", <&bme680>,"reg:0", <&ccs811>,"reg:0",
 			<&bh1750>,"reg:0", <&mcp980x>,"reg:0", <&jc42>,"reg:0";
 		int_pin = <&max30102>, "interrupts:0";
+		no_timeout = <&jc42>, "smbus-timeout-disable?";
 	};
 };
